<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>java script 方法</title>
</head>
<body>
<input type="button" value="按钮" onclick="f6('月半',18)">
<script>
  //1.无参无返回值
  function f1() {
    console.log("f1")
  }
  //调用
  f1();
  //2.有参无返回值
  function f2(name,age){
    console.log(name+":"+age)
  }
f2("孙策",60);
  //3.无参有返回值
  function f3() {
return "我是返回值";
  }
  let info=f3();
  console.log(info);
  //4.有参有返回值
  function f4(x,y) {
return x*y;
  }
  let result=f4(2,3);
  console.log(result);



  //二.第二种声明方法的方式
  let f5=function (name,age) {
    console.log(name+":"+age)
  }
  f5("诸葛亮",54);


  //三.第三种声明方法的方式
  let f6=new Function("name","age","console.log(name+':'+age)")
  f6("司马懿",88);


</script>

</body>
</html>